const path = require('path')
const { defineConfig } = require('@vue/cli-service')

// 正确的 UnoCSS 导入方式
const UnoCSSWebpackPlugin = require('@unocss/webpack')

module.exports = defineConfig({
  transpileDependencies: true,
  configureWebpack: {
    plugins: [
      new UnoCSSWebpackPlugin({
        configOrPath: path.resolve(__dirname, 'uno.config.js')
      })
    ],
    resolve: {
      alias: {
        '@': path.resolve(__dirname, 'src')
      }
    }
  },
  chainWebpack(config) {
    config.module.rule('vue').uses.delete('cache-loader')
    config.module.rule('js').uses.delete('cache-loader')
  }
})